<?php

declare (strict_types=1);

namespace app\base\model;

use app\common\model\CommonModel;



class StaffModel extends CommonModel{

    protected  $table_splice = false;

    protected  $name = 'base_shop_staff';

    protected  $pk   = 'staff_id';



    protected $type=[

        'add_value_jurisdiction'=>'array'

    ];



    public function getJurisdictionAttr($value,$data)

    {

        $return='';

        $jurisdiction=[

            1=>'办理会员',

            2=>'余额充值',

            3=>'积分充值',

            4=>'送券',

        ];

//        if($data['adviser_jurisdiction']==1){

//            $return.='顾问权限、';

//        }

        if($data['write_off_jurisdiction']==1){

            $return.='核销权限、';

        }

        $add_value_jurisdiction=json_decode($data['add_value_jurisdiction'],true);

        if(!empty($add_value_jurisdiction)){

            $return.='加值权限(';

            foreach ($add_value_jurisdiction as $v){

                $return.=$jurisdiction[$v].',' ?? '';

            }

            $return.=')';

        }

        return $return;

    }

}



